{view 'public/head'}
</head>
<body>
    <div class="container-fluid">

        <div id="legend" class="">
            <legend class="">修改菜单</legend>
        </div>
        <form class="form-horizontal" action="{site 'system/menu_edit'}" style="margin:0px" accept-charset="utf-8" method="post">
            <input type="hidden" name="id" value="{$var.id}" />
            <input type="hidden" name="url" value="{$this->t_client->reffer()}" />
            <table class="table table-hover">
                <tr>
                    <th style="width:130px;line-height:30px;text-align:right">目录</th>
                    <td>
                        <div id="meun_category"> 
                            <select class="input-medium meun_grade" data-value="{$var.m_id}" name="grade">
                            </select>
                            <select class="input-medium meun_parentid" data-value="{$var.parentid}" name="parentid">
                            </select>
                        </div>

                    </td>
                </tr>
                <tr>
                    <th style="width:130px;line-height:30px;text-align:right">菜单名称</th>
                    <td><input type="text" name="name" value="{$var.name}" placeholder="输入分类名称" class="input-xlarge" required></td>
                </tr>
                <tr class="controller">
                    <th style="width:130px;line-height:30px;text-align:right">CONTROLLER</th>
                    <td><input type="text" name="controller" value="{$var.controller}" placeholder="输入CONTROLLER" class="input-xlarge"></td>
                </tr>
                <tr class="action">
                    <th style="width:130px;line-height:30px;text-align:right">ACTION</th>
                    <td><input type="text" name="action" value="{$var.action}" placeholder="输入ACTION" class="input-xlarge"></td>
                </tr>
                <tr>
                    <th style="width:130px;line-height:30px;text-align:right">备注</th>
                    <td><input type="text" name="remark" value="{$var.remark}" placeholder="输入备注" class="input-xlarge"></td>
                </tr>
                <tr>
                    <th style="width:130px;line-height:30px;text-align:right"></th>
                    <td><label class="checkbox inline">
                            <input name="status" type="checkbox" value="1"{$var.status?' checked="checked"':''}>
                            显示
                        </label></td>
                </tr>
                <tr class="closeable">
                    <th style="width:130px;line-height:30px;text-align:right"></th>
                    <td><label class="checkbox inline">
                            <input name="closeable" type="checkbox" value="1"{$var.closeable?' checked="checked"':''}>
                            可关闭
                        </label></td>
                </tr>
                <tr class="closeable">
                    <th style="width:130px;line-height:30px;text-align:right"></th>
                    <td><label class="checkbox inline">
                            <input name="home" type="checkbox" value="1"{$var.home?' checked="checked"':''}>
                            首页
                        </label></td>
                </tr>
                <tr>
                    <th style="width:130px;line-height:30px;text-align:right"><span class="loading"><img src="{base 'assets/img/loading.gif'}"></span></th>
                    <td>
                        <button type="submit" class="btn btn-primary input-small"><i class="icon-save"></i> 保存</button> <button type="reset" class="btn input-small"><i class="icon-refresh"></i> 重置</button> 
                        <a href="{$this->t_client->reffer()}" title="取消" class="btn"><i class="icon-double-angle-left"></i> 取消</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>

    {view 'public/js'}
    <script type="text/javascript">
        $(document).ready(function() {
            $('#meun_category').cxSelect({
                selects: ['meun_grade', 'meun_parentid'],
                nodata: 'none',
                url: "{site 'json/menu/'.$var.id}"
            });
            $('.meun_grade').change(function() {
                meungrade = $(this).val();
                if (meungrade == 0) {
                    $('.action').hide();
                    $('.controller').show();
                    $('.closeable').hide();
                } else if (meungrade > 0) {
                    $('.controller').hide();
                    $('.action').hide();
                    $('.closeable').hide();
                }
            })
            $('.meun_parentid').change(function() {
                meunvar = $(this).val();
                if (meunvar == 0) {
                    $('.controller').hide();
                    $('.action').hide();
                    $('.closeable').hide();
                } else if (meunvar > 0) {
                    $('.action').show();
                    $('.closeable').show();
                }
            })
        });
    </script>   
</body>
</html>